package com.caeit

import cn.hutool.log.LogFactory
import org.junit.jupiter.api.MethodOrderer
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestMethodOrder
import org.springframework.boot.test.context.SpringBootTest
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.*

/**
 * 测试基类
 */
@SpringBootTest(classes = [CompBSApplication::class], webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestMethodOrder(MethodOrderer.OrderAnnotation::class)
open class TestBase {
    protected val log = LogFactory.get()
    @Test
    fun contextLoads() {
        println("context Loads")
    }

    @Test
    fun dateconvert(){

        val time = "2009-7-29 14:28:12"
        val df: DateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
        val date: Date = df.parse(time)
        val sdf = SimpleDateFormat("yyyyMMdd")
        val time2 = sdf.format(date)
        println(time2)
    }

    @Test
    fun padTest(){
        for (i in 0..23){
            println(i.toString().padStart(2,'0'))
        }
    }
}